#include<stdio.h>
int main()
{
    long long N;
    int M, num, i, j;

    scanf("%lld %d", &N, &M);
    int score[M];
    
    for(i = 0; i < M; i ++)
    {
        scanf("%d", &num);
        score[i] = num;
    }
    int first, second;
    first = N * 0.1;
    second = N * 0.3;
    for(i = 0; i < M; i++)
    {
        if(score[i] <= first)
        {
            printf("1\n");
        }
        else if(score[i] <= second)
        {
            printf("2\n");
        }
        else{
            printf("3\n");
        }
    }
    return 0;
}
